/**
 * Created by Dalyn on 2017/3/2.
 */
/*导入模块*/
import React from "react";
import {Router, Route, hashHistory, IndexRoute} from "react-router";
/*导入组件*/
import Title from "./Title";
import Tab from "./Tab";
import TabMenu from "./Tab_menu";
import SysHome from "./SysHome";
import HomePage from "../homepage/HomePage";
import CompanyManage from "../companymanage/CompanyManage";
import IndentManage from "../indentmanage/IndentManage";
import ProductManage from "../productmanage/ProductManage";
import TicklingList from "../tickling/TicklingList";

import CreateCompany from "../companymanage/CreateCompany";
import EditCompany from "../companymanage/EditCompany";
import SettingManage from "../settings/SettingManage";
import People from "../people/People";
import SelCompanyType from "../companymanage/SelCompanyType";
import ProductImport from "../productmanage/ProductImport";
import ViewCompany from "../companymanage/ViewCompany";
import ReplyDetail from "../tickling/ReplyDetail"
// import OrderTree from "../indentmanage/OrderTree"
import OrderTree from '../indentmanage/order_tree/OrderTree';
/*系统设置*/
import ManagerList from "../sysmanager/ManagerList";
import RoleManage from "../rolemanage/RoleManage";
import NewRole from "../rolemanage/NewRole";
import EditRole from "../rolemanage/EditRole";
/*结算中心*/
import RechargeSettlement from "../recharge/RechargeSettlement";
import SettlementCenter from "../settlement/SettlementCenter";
import SettlementCenterEye from '../settlement/ToViewEye';

import LoanFinance from "../loan/LoanFinance";

import EnterprisePage from '../homepage/EnterprisePage';
import OrderPage from '../homepage/OrderPage';
/*订单详情*/
import Orderdetail_gms from "../indentmanage/order_detail/Orderdetail_gms";
import Orderdetail_cloth from "../indentmanage/order_detail/Orderdetail_cloth";
import Orderdetail_print from "../indentmanage/order_detail/Orderdetail_print";
import Orderdetail_raw from "../indentmanage/order_detail/Orderdetail_raw";
import Orderdetail_yarn from "../indentmanage/order_detail/Orderdetail_yarn";
import OrderIndex from '../indentmanage/order_detail/order_index/Order_index';
/*发票管理*/
import InvoiceManage from "../invoiceManage";
/* 发票树 */
import InvoiceManageTree from '../invoiceManage/Invoicemanage_tree';
/* 退税管理 */
import Rebatemanage from '../rebatemanage';
/*路由参数*/
const navs = [
    {name: "首页", path: "/syshome", component: SysHome, isShowTitle: false},
    {name: "数据统计", path: "/homepage", component: HomePage, isShowTitle: false},
    {name: "企业管理", path: "/companymanage", component: CompanyManage, isShowTitle: false},
    {name: "用户管理", path: "/usermanage", component: People, isShowTitle: false},
    {name: "订单管理", path: "/indentmanage", component: IndentManage, isShowTitle: false},
    {name: "产品管理", path: "/productmanage", component: ProductManage, isShowTitle: false},
    //{name: "已导入产品", path: "/productImported", component: ProductManage, isShowTitle: false},
    //{name: "未导入产品", path: "/productNotImported", component: ProductImport, isShowTitle: false},
    // {name: "审批管理", path: "/examinemanage", component: ExamineManage, isShowTitle: false},
    // {name: "后台人员管理", path: "/backstaffmanage", component: BackStaffManage, isShowTitle: false},
    // {name: "后台权限设置", path: "/backlimitmanage", component: BackLimitManage, isShowTitle: false},
    {name: "新建企业", path: "/createCompany", component: CreateCompany, isShowTitle: false},
    {name: "选择企业类型", path: "/selCompanyType", component: SelCompanyType, isShowTitle: false},
    {name: "编辑企业", path: "/editCompany(/:enterpriseId)", component: EditCompany, isShowTitle: false},
    {name: "查看企业", path: "/viewCompany(/:enterpriseId)", component: ViewCompany, isShowTitle: false},
    {name: "系统设置", path: "/settingmanage", component: SettingManage, isShowTitle: false},
    {name: "人员管理", path: "/managerlist", component: ManagerList, isShowTitle: false},
    {name: "角色管理", path: "/rolemanage(/:pageNum)(/:pageSize)", component: RoleManage, isShowTitle: false},
    {name: "编辑权限", path: "/newrole", component: NewRole, isShowTitle: false},
    {name: "编辑角色", path: "/editrole(/:rid)(/:pageNum)(/:pageSize)", component: EditRole, isShowTitle: false},
    {name: "账户充值(结算中心)", path: "/rechargesettlement", component: RechargeSettlement, isShowTitle: false},
    {name: "结算(结算中心)", path: "/settlementcenter", component: SettlementCenter, isShowTitle: false},
    {name:"结算结果查看",path:"settementCenterEye",component:SettlementCenterEye,isShowTitle:false },
    {name: "贷款记录", path: "/loanfinance", component: LoanFinance, isShowTitle: false},
    {name: "反馈处理", path: "/tickling", component: TicklingList, isShowTitle: false},
    {name: "反馈详情", path: "/ReplyDetail(/:sid)", component: ReplyDetail, isShowTitle: false},
    {name: "首页企业统计",path:"/entercensus",component:EnterprisePage,isShowTitle:false},
    {name: "首页订单统计",path:"/ordercensus",component:OrderPage,isShowTitle:false},
    {name: "订单树", path: "/ordertree", component: OrderTree, isShowTitle: false},
    {name: "成衣订单详情", path: "/orderdetailgms(/:orderId)", component: Orderdetail_gms, isShowTitle: false},
    {name: "布料订单详情", path: "/orderdetailcloth(/:orderId)", component: Orderdetail_cloth, isShowTitle: false},
    {name: "纱线订单详情", path: "/orderdetailyarn(/:orderId)", component: Orderdetail_yarn, isShowTitle: false},
    {name: "印染订单详情", path: "/orderdetailprint(/:orderId)", component: Orderdetail_print, isShowTitle: false},
    {name: "辅料订单详情", path: "/orderdetailraw(/:orderId)", component: Orderdetail_raw, isShowTitle: false},
    {name: "订单主入口", path: "/OrderIndex(/:orderId)", component: OrderIndex, isShowTitle: false},

    {name:"发票管理",path: "/invoicemanage", component: InvoiceManage, isShowTitle: false},
    {name:"发票管理树",path: "/Invoicemanagetree", component: InvoiceManageTree, isShowTitle: false},
    {name:"退税管理",path: "/rebatemanage", component: Rebatemanage, isShowTitle: false},
];

/*导出组件*/
export default class Main extends React.Component {
    /*默认属性状态*/
    constructor(props) {
        super(props)
    }

    /*渲染前*/
    componentWillMount() {
    }

    /*渲染后*/
    componentDidMount() {
    }

    // shouldComponentUpdate(){}
    componentDidUpdate() {
    }

    /*移除*/
    componentWillUnmount() {
    }

    /*渲染*/
    render() {
        return (
            /*路由组件*/
            <Router history={hashHistory}>
                <Route path="/" component={TabComponent}>
                    <IndexRoute component={SysHome}/>
                    {
                        navs.map((item, index) => {
                            return <Route {...item} key={index + '_'}/>
                        })
                    }
                </Route>
            </Router>
        );
    }
}
/*路由组件*/
class TabComponent extends React.Component {
    constructor(props) {
        super(props)
    }

    render() {
        return (
            <div style={style.main}>
                <TabMenu/>
                <div style={style.title}>
                    <Title />
                </div>
                <div style={style.box}>
                    {this.props.children}
                </div>
            </div>
        );
    }
}
let style = {
    main: {
        // position:"relative",
        width: '100%',
        margin: "0 auto",
        overflow: "hidden",
        clear: "both",
        zIndex: -1
    },
    title: {
        backgroundColor: '#f9f9f9',
        /*paddingLeft: "166px",*/
        overflow: "hidden",
        clear: "both",
        zIndex: -1
    },
    box: {
        width: '1235px',
        margin: "0 auto",
        paddingLeft: "166px",
        overflow: "hidden"
    }
};